<?php
if (!defined('IN_D_ADMIN')) die("Error 404");
$menu_arr = array(
	'cat'	=>	array(
		$lang_acp['cat'],
		array(
			'edit'	=>	array($lang_acp['manager_cat'],'act=cat&mode=edit'),
			'add'	=>	array($lang_acp['add_cat'],'act=cat&mode=add'),
		),
	),
	'news'	=>	array(
		$lang_acp['news'],
		array(
			'edit_news'	=>	array($lang_acp['manager_news'],'act=news&mode=edit'),
			'add'	=>	array($lang_acp['add_news'],'act=news&mode=add'),
			'focus_news'	=> array($lang_acp['manager_focus_news'],'act=focus&mode=add'),
		),
	),

	'request'	=>	array(
		$lang_acp['request'],
		array(
			'edit'    =>    array($lang_acp['manager_request'],'act=request&mode=view'),
		),
	),

	'user'	=>	array(
		$lang_acp['user'],
		array(
			'edit'	=>	array($lang_acp['manager_user'],'act=user&mode=edit'),
			'add'	=>	array($lang_acp['add_user'],'act=user&mode=add'),
		),
	),

	'link'	=>	array(
		$lang_acp['ads'],
		array(
			'edit'	=>	array($lang_acp['manager_ads'],'act=ads&mode=edit'),
			'add'	=>	array($lang_acp['add_ads'],'act=ads&mode=add'),
		),
	),

	'template'	=>	array(
		$lang_acp['tpl'],
		array(
			'edit'	=>	array($lang_acp['manager_tpl'],'act=tpl&mode=edit'),
			'add'	=>	array($lang_acp['add_tpl'],'act=tpl&mode=add'),
		),
	),
	'config'	=>	array(
		$lang_acp['config'],
		array(
			'set_mod_permission'	=>	array($lang_acp['set_mod_per'],'act=mod_permission'),
			'config'	=>	array($lang_acp['config'],'act=config'),
			'config_server'	=>	array($lang_acp['config_server'],'act=server'),
			'config_lserver'	=>	array($lang_acp['config_lserver'],'act=lserver'),
			'site_off'	=>	array($lang_acp['site_off'],'act=site_off'),
			'backup_data'	=>	array($lang_acp['backup_data'],'act=backup'),
		),
	)
);
if ($level == 2) {

	unset($menu_arr['config']);
	foreach ($menu_arr as $key => $v) {
		if (!$mod_permission['add_'.$key]) unset($menu_arr[$key][1]['add']);
		if (!$mod_permission['edit_'.$key]) unset($menu_arr[$key][1]['edit']);
		
		if ($key == 'media' && !$mod_permission['edit_'.$key]) unset($menu_arr[$key][1]['edit_broken']);
		if ($key == 'media' && !$mod_permission['add_'.$key]) unset($menu_arr[$key][1]['add_multi']);
		
		if (!$menu_arr[$key][1]) unset($menu_arr[$key]);
	}
}
echo "<div><form name=\"switch_lang_acp\" method=\"post\" action=\"index.php\">&nbsp;&nbsp;<select name=\"language_acp\" onchange=\"this.form.submit();\">
				<optgroup  label=\"".$lang_acp['select_language']."\">
				<option value=\"en\" class=\"\" ".$se_acp_en.">-- English</option>
				<option value=\"vi\" class=\"\" ".$se_acp_vi.">-- Viet Nam</option>
				</optgroup>
				</select>
				</form></div>";
echo "<div><a href='index.php?act=main'><b>{$lang_acp['home']}</b></a> || <a href='logout.php'><b>{$lang_acp['logout']}</b></a></div>";
foreach ($menu_arr as $key => $arr) {
	echo "<table cellpadding=2 cellspacing=0 width=100% class=border style='margin-bottom:5'>";
	echo "<tr><td class=title><b>".$arr[0]."</b></td></tr>";
	foreach ($arr[1] as $m_key => $m_val) {
		echo "<tr><td><a href=\"?".$m_val[1]."\">".$m_val[0]."</a></td></tr>";
	}
	echo "</table>";
}

?>